import tensorflow.compat.v1 as tf
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"

convert = tf.lite.TFLiteConverter.from_frozen_graph("data\model.pb",
                                                    input_arrays=["images"],
                                                    input_shapes={"images": [1,416,416,3]},
                                                    output_arrays=["detection_scores","num_detections","detection_classes"])
convert.post_training_quantize = True
tflite_model = convert.convert()
open("model.tflite", "wb").write(tflite_model)
print("finish!")